import axios from 'axios'
import request from '../utils/request'
import {URL} from '../utils/url'

//获取关注数和粉丝数
export function getFollowCount(uid){
  const url = URL + 'api/auth/follow/count'
  const data ={
    'uid': uid,
  }
  return axios.get(url,{
    params: data
  }).then(res => {
    return Promise.resolve(res)
  })
}

//获取关注列表
export function getFollowingList(uid){
    const url = URL + 'api/auth/following'
    const data ={
      'uid': uid,
    }
    return axios.get(url,{
      params: data
    }).then(res => {
      return Promise.resolve(res)
    })
}

//获取粉丝列表
export function getFollowerList(uid){
    const url = URL + 'api/auth/follower'
    const data ={
      'uid': uid,
    }
    return axios.get(url,{
      params: data
    }).then(res => {
      return Promise.resolve(res)
    })
}

//判断是否关注
export function getIsFollow(uid,fid){
    const url = URL + 'api/auth/isFollow'
    const data ={
      'uid': uid,
      'fid': fid,
    }
    return axios.get(url,{
      params: data
    }).then(res => {
      return Promise.resolve(res)
    })
}

//关注
export function follow({id}){
    return request.post('auth/follow',{id})
}

//取关
export function unsubscribe({id}){
    return request.post('auth/unsubscribe',{id})
}

